function LeaveChannelNotify(name,playerId){
    this.id = "LeaveChannel";
    this.name = name;
    this.playerId = playerId;

}

function EnterChannelNotify(name,playerId,player){
    this.id = "EnterChannel";
    this.name = name;
    this.playerId = playerId;
    var rate = 0;
    var total = player.win + player.lost + player.drop;
    if(total > 0){
        rate = player.win/total;
    }
    this.playerData = [player.name,player.swordLevel,player.wuli,player.win,player.lost,player.drop,rate,player.id];
}

function BattleNotify(id,name){
    this.id = "Battle";
    this.playerId = id;
    this.name = name;
}

function BattleServerReplyNotify(id,name,result){
    this.id = "BattleServerReply";
    this.playerId = id;
    this.name = name;
    this.result = result;
}

function BattleStartNotify(enemyId,enemyData,cards){
    this.id = "BattleStart";
    this.playerId = enemyId;
    this.enemyData = enemyData;
    this.cards = cards;

}

function BattleRoundResultNotify(result){
    this.id = "BattleRoundResult";
    this.result = result;
}

module.exports ={
   "LeaveChannelNotify":LeaveChannelNotify,
    "EnterChannelNotify":EnterChannelNotify,
    "BattleNotify":BattleNotify,
    "BattleServerReplyNotify":BattleServerReplyNotify,
    "BattleStartNotify":BattleStartNotify,
    "BattleRoundResultNotify":BattleRoundResultNotify
};